package com.roroldo.springcloud.service;

import com.roroldo.springcloud.entities.CommonResult;
import com.roroldo.springcloud.entities.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Component
// 表明服务提供方
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")
public interface PaymentFeignService {

    // 映射路径、方法参数和返回值必须与服务提供方一致，方法名可以不同
    @GetMapping(value = "/payment/get/{id}")
    CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);

    // Feign 超时控制
    @GetMapping(value = "/payment/feign/timeout")
    String paymentFeignTimeOut();
}
